/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "insure")
@NamedQueries({
    @NamedQuery(name = "Insure.findAll", query = "SELECT i FROM Insure i"),
    @NamedQuery(name = "Insure.findByInsureId", query = "SELECT i FROM Insure i WHERE i.insureId = :insureId"),
    @NamedQuery(name = "Insure.findByInsureName", query = "SELECT i FROM Insure i WHERE i.insureName = :insureName"),
    @NamedQuery(name = "Insure.findByInsureDescrip", query = "SELECT i FROM Insure i WHERE i.insureDescrip = :insureDescrip")})
public class Insure implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "insure_id")
    private Integer insureId;
    @Basic(optional = false)
    @Column(name = "insure_name")
    private String insureName;
    @Column(name = "insure_descrip")
    private String insureDescrip;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "insure", fetch = FetchType.LAZY)
    private List<InsureMiddle> insureMiddleList;

    public Insure() {
    }

    public Insure(Integer insureId) {
        this.insureId = insureId;
    }

    public Insure(Integer insureId, String insureName) {
        this.insureId = insureId;
        this.insureName = insureName;
    }

    public Integer getInsureId() {
        return insureId;
    }

    public void setInsureId(Integer insureId) {
        this.insureId = insureId;
    }

    public String getInsureName() {
        return insureName;
    }

    public void setInsureName(String insureName) {
        this.insureName = insureName;
    }

    public String getInsureDescrip() {
        return insureDescrip;
    }

    public void setInsureDescrip(String insureDescrip) {
        this.insureDescrip = insureDescrip;
    }

    public List<InsureMiddle> getInsureMiddleList() {
        return insureMiddleList;
    }

    public void setInsureMiddleList(List<InsureMiddle> insureMiddleList) {
        this.insureMiddleList = insureMiddleList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (insureId != null ? insureId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Insure)) {
            return false;
        }
        Insure other = (Insure) object;
        if ((this.insureId == null && other.insureId != null) || (this.insureId != null && !this.insureId.equals(other.insureId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.Insure[insureId=" + insureId + "]";
    }

}
